/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package MODEL;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author ahmed
 */
@Entity
@Table(name = "RESERVER2")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Reserver2.findAll", query = "SELECT r FROM Reserver2 r"),
    @NamedQuery(name = "Reserver2.findByIdC", query = "SELECT r FROM Reserver2 r WHERE r.reserver2PK.idC = :idC"),
    @NamedQuery(name = "Reserver2.findByIdItem", query = "SELECT r FROM Reserver2 r WHERE r.reserver2PK.idItem = :idItem"),
    @NamedQuery(name = "Reserver2.findByDater", query = "SELECT r FROM Reserver2 r WHERE r.dater = :dater"),
    @NamedQuery(name = "Reserver2.findByQuantiter", query = "SELECT r FROM Reserver2 r WHERE r.quantiter = :quantiter")})
public class Reserver2 implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected Reserver2PK reserver2PK;
    @Basic(optional = false)
    @Column(name = "DATER")
    @Temporal(TemporalType.TIMESTAMP)
    private Date dater;
    @Basic(optional = false)
    @Column(name = "QUANTITER")
    private BigInteger quantiter;
    @JoinColumn(name = "ID_C", referencedColumnName = "ID_C", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Client client;

    public Reserver2() {
    }

    public Reserver2(Reserver2PK reserver2PK) {
        this.reserver2PK = reserver2PK;
    }

    public Reserver2(Reserver2PK reserver2PK, Date dater, BigInteger quantiter) {
        this.reserver2PK = reserver2PK;
        this.dater = dater;
        this.quantiter = quantiter;
    }

    public Reserver2(String idC, BigInteger idItem) {
        this.reserver2PK = new Reserver2PK(idC, idItem);
    }

    public Reserver2PK getReserver2PK() {
        return reserver2PK;
    }

    public void setReserver2PK(Reserver2PK reserver2PK) {
        this.reserver2PK = reserver2PK;
    }

    public Date getDater() {
        return dater;
    }

    public void setDater(Date dater) {
        this.dater = dater;
    }

    public BigInteger getQuantiter() {
        return quantiter;
    }

    public void setQuantiter(BigInteger quantiter) {
        this.quantiter = quantiter;
    }

    public Client getClient() {
        return client;
    }

    public void setClient(Client client) {
        this.client = client;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (reserver2PK != null ? reserver2PK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Reserver2)) {
            return false;
        }
        Reserver2 other = (Reserver2) object;
        if ((this.reserver2PK == null && other.reserver2PK != null) || (this.reserver2PK != null && !this.reserver2PK.equals(other.reserver2PK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "MODEL.Reserver2[ reserver2PK=" + reserver2PK + " ]";
    }
    
}
